package com.shaozi.nc.mq.producer;

import org.apache.log4j.Logger;

import com.shaozi.data.mq.business.bean.MQExchangeData;
import com.shaozi.data.mq.protocol.ConnectionBuilder;
import com.shaozi.data.mq.protocol.stomp.StompTextProducer;

public class SendIMInfoProducer extends StompTextProducer {

	private Logger log = Logger.getLogger(SendIMInfoProducer.class);
	private String destName;

	public SendIMInfoProducer(ConnectionBuilder connBuilder) {
		super(connBuilder);
	}

	public String getDestName() {
		return "api." + destName;
	}

	public void setDestName(String destName) {
		this.destName = destName;
	}

	public void push(MQExchangeData data) {
		if (data == null)
			return;
		String destName = getDestName();
		boolean ok = sendObj(destName, data);
		if (!ok) {
			log.warn("send mq error:" + getDestName());
		}
	}
}
